 let name = "向军";
 let grade = [
	 { lesson: "js", score: 99 },
	 { lesson: "mysql", score: 85 }
 ];
 function average(grade, name) {
 	const total = grade.reduce((t, a) => t + a.score, 0);
 	return name + ":" + total / grade.length + "分";
 }
 console.log(average(grade, name));

 var user = {
 	name : '刘阿勇',
 	grade : [
	 	{ lesson: "js", score: 99 },
	 	{ lesson: "mysql", score: 85 }
 	],

 	average() {
 		const total = this.grade.reduce((total, a)=> {
 			return total + a.score
 		}, 0)

 		return `${this.name}:${total / this.grade.length}分 `
 	}

 }

 console.log(user.average())


